<?php
	is_path();
	$route = param(1,'index');
	if ($route === 'rename') {
		if ($method === 'POST') {
				// post提交
				$newname = param('newname');
				if (preg_match('/[\Q\/|:*"<>\E]/', $newname)) {
					jump('文件夹名不符合规范不能包含:/ \ : * " &lt; &gt; |',$REFERER);
				}
				if (rename(param('path'), $now_dir.'/'.$newname)) {
					jump('文件夹名 [ '.$newname.' ] 更名成功!',create_url('index','',$now_dir),true);
				}
				jump('文件夹名 [ '.$newname.' ] 更名失败!',$REFERER);
		}
		assign('nowname',basename(param('path')));
		view('rename');
	}elseif($route === 'upload'){
		//上传文件
		$result = upload('file',$now_path);
		if ($result['error']) {
			jump($result['message'],create_url('index','',$now_path),true);
		}
		jump($result['message'],create_url('index','',$now_path));
	}